#include <Wire.h>
#if defined(NOATIN_UNO_WIFI_DEV_ED)
#warning ML_Message:NOATIN UNO WIFI
#include <UnoWiFiDevEd_Noatin.h>
#else
#warning ML_Message:ARUDINO UNO WIFI
#include <UnoWiFiDevEd.h>
#endif
//#define DEBUG 1

class ML_DEPS : public ArduinoWifiClass 
{
    public:
    ML_DEPS(){
        this->begin();
    }
    int read(){
        if(!this->connected() || this->available()==0){
            return -1;
        }
        int r = ArduinoWifiClass::read();
        if(r==255){
            return -1;
        }else{
            return r;
        }
    }
};
/*
Stream* ML_Message_CreateStream(){
    ML_DEPS* w = new ML_DEPS;
    w->setTimeout(1);
    w->begin();
    w->setTimeout(1);
    return w;
}
*/
Stream* ML_Message_CreateStream(){
    Wifi.begin();
    
#ifdef DEBUG
Serial.println("Wifi start.");
#endif
    return &Wifi;
}